package com.net.readcard

import com.net.bean.ResultSocketData
import com.idcard.utils.Base64Helper
import com.idcard.utils.CodeUtil
import com.net.utils.JsonUtils
import org.junit.Test

import org.junit.Assert.*

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun addition_isCorrect() {
        assertEquals(4, 2 + 2)
    }

    @Test
    fun gsonTest(){
        val json = "{\"code\":\"00\",\"msg\":\"成功\",\"token\":\"EUorChiVxMaW9G907DVa\"}"
        println("注册登录返回, 开始解析")
        val resultSocketData: ResultSocketData? = JsonUtils.fromJsonForGson(json)
        println("注册登录返回, 结束解析")
        println(JsonUtils.toJsonForGson(resultSocketData))
    }

    @Test
    fun gzip(){
        val str = "H4sIAAAAAAAAAKtWyi1OV7JSerF88fMFjc86Jjztmq+ko5Scn5IKFDUwALJTEksSlayidc0sdYyNdXQNgShWRykzxTmxKEXJqlopKbOoJCMlsRKo3tDS0sTA1MgQqCsxJaUotbgYKPhs0+anvdOfz2l82tr5dOPGp337n65fARR8ObX92bqtIPbciS9XroEwnm2Y+Hx3iwIGAJqYWVxcCnIUwpjWNU/XAdkNyKpS81JcEktA6owMjCwMDQ1MgYJ5iSWZ+Xkgt2zsBHKLUyuA7OdTtoOlckGKgQ540brvxez56JYCvahkYmhoamQE85yBpbERyJCSxKISuFWGEKtqdZRKKgtAQpkpqXlKtQBicgO4XwEAAA=="
        val base64Byte = _root_ide_package_.com.idcard.utils.Base64Helper.decode(str)
        println("Base64Helper解密HEX：")
        println(_root_ide_package_.com.idcard.utils.CodeUtil.bytesToHexString(base64Byte))

//        val decodeStr = GzipUtils.uncompress(str)
//        println("GzipUtils：")
//        println(decodeStr.trim())

    }
}